/*
 *         Copyright (c) KUBOTA Corporation and HUDSON SOFT,
 *                  1994, 1995 All Rights Reserved
 *
 *  This software comprises unpublished confidential information of
 *  KUBOTA Corp. and HUDSON SOFT. It may not be used, copied or made 
 *  available to anyone, except in accordance with the license under
 *  which it is furnished.
 */
static char SccsId[] = "@(#)look1.c	1.8	9/19/95";
#include <farl.h>
#include <agl.h>
unsigned int cube[] = {
#include "cubestp.h"
};

object	o, o2;
fix187	ot[3] = { 0x0, 0x0, 0x40};

void	DoCameraRotate2();

void main()
{
     int		i;
     Material	mt1= {0x4000, 0x4000, 0x1fff,};

     FX73init();
     FX73_cmap_i6c3();
     AGLInit();

     FarlSetPEClearColorReg(0x807);
     FarlSetPEICMaskReg(FARL_ICMASK_I6C3);
     FarlSetTEControlReg(FARL_TE_LTEN|FARL_TE_ICM|FARL_TE_SPEN|FARL_TE_BCE);
     FarlValidateSwap();

     AGLSetLight(AGL_LIGHT1, 0x8001, 0x0, 0x0, 0x7fff);
     AGLSetMaterial(&mt1, 1);

     o.geometryTop    = o2.geometryTop    = cube;
     o.geometryLength = o2.geometryLength = sizeof(cube)/sizeof(int);
     o2.material      = NULL;
     o.material       = &mt1;

     DoCameraRotate2();
     return;
}
void DoCameraRotate2()
{
     int		i;

     for (i = 0; i <= 0x160; i+=1) {
	  AGLResetObj(&o);
	  AGLTranslateObj(&o,
			  (unsigned short)(0xff80 + i),
			  (unsigned short)(0xff80 + i),
			  0xffc0);

	  AGLResetObj(&o2);
	  AGLRotateObjX(&o2, i%3600);
	  AGLTranslateObj(&o2, 0x0, 0x0, 0xffe0);

	  AGLResetCamera();
	  AGLLookAtCamera(
			  (unsigned short)(0xff80 + i),
			  (unsigned short)(0xff80 + i),
			  0xffc0,
			  FarlGetSin1015(i*20 % 3600),
			  FarlGetCos1015(i*20 % 3600),
			  0x0);
	  AGLZoomCamera(0x80, 0x80, 0x20);
	  AGLPerspectiveCamera(0xff80);
	  AGLFixPutObj(&o);
	  AGLShot();
     }
}
